package com.proyecto.track.dao;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.transaction.annotation.Transactional;

import com.proyecto.track.bo.Proyecto;
import com.proyecto.track.bo.Rol;


@Transactional(rollbackFor=Exception.class)
public class RolesDAOImp extends HibernateDaoSupport implements RolesDAO {

	/**
	 * Inits the session factory.
	 * 
	 * @param factory
	 *            the factory
	 */
	@Autowired
	public void initSessionFactory(SessionFactory factory) {
	    setSessionFactory(factory);
	}

	public List<Rol> getAllRoles() {
		return super.getHibernateTemplate().find("from Rol");
	}

	public Rol getRolById(Long id) {
		return (Rol) super.getHibernateTemplate().get(Rol.class, id);
	}
}
